package com.imc.platform.base.order.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.imc.api.order.pojo.LessonSchedule;
import com.imc.platform.base.order.dao.IPlatOrderMapper;
import com.imc.platform.base.order.pojo.Order;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


import java.util.Map;

/*
 * 类描述：订单信息服务类
 * 开发者：YT
 * 创建日期：2018/10/12 23:01
 */
@Transactional
@Slf4j
@Service
public class PlatOrderServiceImpl implements IPlatOrderService {

    @Autowired
    IPlatOrderMapper iOrderMapper;

    /*
     * YT  2018/10/12 23:00
     * 方法描述：分页查询订单信息
     */
    public PageInfo <Order> queryOrderByMap(int pageNumber, int pageSize, Map <String, String> orderMap) {
        PageHelper.startPage(pageNumber, pageSize, true);
        PageInfo info = new PageInfo <Order>(iOrderMapper.queryOrderByMap(orderMap));
        return info;
    }

    @Override
    public PageInfo <LessonSchedule> queryLessonSchedule(int pageNumber, int pageSize, Map <String, String> lessonScheduleMap) {
        PageHelper.startPage(pageNumber, pageSize, true);
        PageInfo info = new PageInfo <LessonSchedule>(iOrderMapper.queryLessonSchedule(lessonScheduleMap));
        return info;
    }

    /*
     * YT  2018/10/12 23:00
     * 方法描述：根据订单ID，订单明细ID查询订单信息
     */
    @Override
    public Order queryOrderOrDetailById(String orderId, String detailId) {
        Order orderInfo = iOrderMapper.queryOrderOrDetailById(orderId, detailId);
        return orderInfo;
    }
}
